home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-06-19 | 1.8 KB | 92 lines | [TEXT/CWIE] |
- // PipeOutput.h
-
- #ifndef PipeOutput_h
- #define PipeOutput_h
-
- #ifndef ConstBufferMaster_h
- #include "ConstBufferMaster.h"
- #endif
- #ifndef Sleeper_h
- #include "Sleeper.h"
- #endif
- #ifndef PipePacket_h
- #include "PipePacket.h"
- #endif
- #ifndef TaskSequencer_h
- #include "TaskSequencer.h"
- #endif
-
- class TeeBase;
-
- class PipeOutput
- {
- friend class PipeOutputMaster;
-
- private:
- ConstBufferMaster buffer;
- ConstData ring;
- TeeBase *pipe;
-
- PipePacket entering;
- PipePacket exiting;
-
- Sleeper sleep;
- uint32 acceptLength;
-
- bool flushing;
-
- TaskSequencer<PipeOutput> sequence;
- typedef TaskStep<PipeOutput> Step;
-
- PipeOutput();
- void Initialize( ConstData, TeeBase& );
- void Reset();
-
- void PushIn( PipePacket );
- const PipePacket& Leaving() const { return exiting; }
- void PullOut( PipePacket out ) { exiting -= out; }
- uint32 Audit() const;
- const uint8 *ExitingStart() const;
- const uint8 *EnteringEnd() const;
-
- void MoveBuffer();
-
- Step DoPass( bool dying, DeferredTaskTime );
- Step TryAccept( bool dying, DeferredTaskTime );
- Step DoAcknowledgeFlush( bool dying, DeferredTaskTime );
-
- public:
- ConstBuffer& Buffer() { return buffer; }
- const ConstBuffer& Buffer() const { return buffer; }
-
- uint32 PotentialLength() const;
- uint32 RingLength() const { return ring.Length(); }
-
- uint32 LargestAcceptSize() const;
- uint32 ReasonableAcceptSize() const;
- uint32 ReasonablePassSize() const;
-
- bool Flushing() const { return flushing; }
-
- Task *Pass();
- Task *Accept( uint32 requiredSize );
- Task *AcknowledgeFlush();
- };
-
- class PipeOutputMaster: public PipeOutput
- {
- public:
- PipeOutputMaster() {} // To keep CW Pro 3 happy
-
- PipeOutput::Initialize;
- PipeOutput::Reset;
- PipeOutput::PushIn;
- PipeOutput::Leaving;
- PipeOutput::PullOut;
- PipeOutput::Audit;
- PipeOutput::ExitingStart;
- PipeOutput::EnteringEnd;
- };
-
- #endif
-